class Rule
  
  class << self
    def can_view_admin?(user)
      user.role.view_admin? 
    end
    
    def can_view_store?(user)
      user.role.view_store?      
    end
    
    def can_view_site?(user)
      user.role.view_intranet? && user.role.view_extranet?
    end
    
    def can_manage_users?(user) 
      user.role.modify_user? && user.role.add_user?
    end
    
    def can_manage_news?(user)
      user.role.modify_actuality? && user.role.create_actuality?
    end
    
    def can_manage_articles?(user)
      user.role.modify_article? && user.role.add_article?
    end
    
    def can_manage_products?(user)
      user.role.modify_product? && user.role.add_product?
    end
        
    def registration_enable?
      Setting.registration.to_i == 1
    end
  end
end